//
//  Base24HController.m
//  网易新闻
//
//  Created by dllo on 15/10/10.
//  Copyright (c) 2015年 Lx. All rights reserved.
//

#import "Base24HController.h"
#import "Settings.h"
@interface Base24HController ()

@end
@implementation Base24HController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [[Settings shareSettings]color:WhiteToGray];
    [self addImg];
    [self createTableView];
}

- (void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = YES;
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
}

- (void)viewWillDisappear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = NO;
}

- (void)addImg{
    self.img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 20, 375, 190)];
    self.img.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:self.imgname ofType:@"jpg"]];
    [self.view addSubview:self.img];
    [self.img release];
    
    UILabel *desc = [[UILabel alloc]initWithFrame:CGRectMake(110, 145, 155, 40)];
    desc.textColor = [UIColor whiteColor];
    desc.font = [UIFont systemFontOfSize:15];
    desc.numberOfLines = 0;
    desc.text = self.desc;
    [desc sizeToFit];
    [self.img addSubview:desc];
    [desc release];
}

- (void)createTableView{
    [self setTableView];
    [self notificationHandle];
}

- (void)setTableView{
    self.table = [[UITableView alloc]initWithFrame:CGRectMake(0, 210, 375, 457) style:UITableViewStylePlain];
    self.table.backgroundColor = [[Settings shareSettings]color:WhiteToGray];
    [self.view addSubview:self.table];
    [self.table release];
    self.table.tableFooterView = [[UIView alloc]init];
}

- (void)notificationHandle{
    [[NSNotificationCenter defaultCenter]addObserverForName:@"changeBackgroundColor" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
        self.view.backgroundColor = [[Settings shareSettings]color:WhiteToGray];
        self.table.backgroundColor = [[Settings shareSettings]color:WhiteToGray];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)dealloc{
    [_desc release];
    [_table release];
    [_modArr release];
    [_img release];
    [_imgname release];
    [super dealloc];
}


@end
